<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>家庭药品管理 - 搜索结果</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/common.css">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#16a34a',
                        secondary: '#4ade80',
                        dark: '#1e293b',
                        light: '#f8fafc'
                    }
                }
            }
        }
    </script>
    <style>
        /* iPhone 15 模拟外壳样式 */
        .iphone-frame {
            width: 390px;
            height: 844px;
            border-radius: 44px;
            background-color: #000;
            margin: 20px auto;
            position: relative;
            overflow: hidden;
            box-shadow: 0 0 0 10px #111, 0 0 0 11px #333, 0 20px 50px rgba(0, 0, 0, 0.3);
        }
        
        /* 顶部刘海区域 */
        .iphone-notch {
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 200px;
            height: 30px;
            background-color: #000;
            border-radius: 0 0 20px 20px;
            z-index: 10;
        }
        
        /* 底部安全区域 */
        .iphone-home-indicator {
            position: absolute;
            bottom: 8px;
            left: 50%;
            transform: translateX(-50%);
            width: 120px;
            height: 5px;
            background-color: rgba(255, 255, 255, 0.6);
            border-radius: 5px;
            z-index: 10;
        }
        
        /* 顶部状态栏 */
        .iphone-status-bar {
            height: 50px;
            background-color: #fff;
            padding-top: 15px;
            padding-left: 20px;
            padding-right: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 14px;
            font-weight: 600;
        }
        
        /* 页面标题栏 */
        .page-header {
            height: 44px;
            background-color: #fff;
            display: flex;
            align-items: center;
            padding: 0 16px;
            border-bottom: 1px solid #e5e7eb;
        }
        
        .back-button {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            color: #1e293b;
        }
        
        .header-title {
            font-size: 18px;
            font-weight: 600;
            color: #1e293b;
            flex: 1;
            text-align: center;
            margin-right: 40px; /* 为了标题居中对齐 */
        }
        
        /* 内容区域 */
        .iphone-content {
            height: calc(100% - 50px - 44px - 83px);
            background-color: #f8fafc;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        
        /* 底部导航栏 */
        .iphone-nav {
            height: 83px;
            background-color: white;
            border-top: 1px solid #e5e7eb;
            display: flex;
            justify-content: space-around;
            align-items: center;
            position: absolute;
            bottom: 0;
            width: 100%;
        }
        
        /* 导航项样式 */
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: #9ca3af;
            text-decoration: none;
            font-size: 12px;
        }
        
        .nav-item.active {
            color: #16a34a;
        }
        
        .nav-item i {
            font-size: 22px;
            margin-bottom: 5px;
        }
        
        /* 搜索结果样式 */
        .search-bar {
            padding: 12px 16px;
            background-color: white;
            display: flex;
            align-items: center;
            border-bottom: 1px solid #f1f5f9;
        }
        
        .search-input-container {
            flex: 1;
            height: 40px;
            background-color: #f1f5f9;
            border-radius: 20px;
            display: flex;
            align-items: center;
            padding: 0 16px;
            margin-right: 12px;
        }
        
        .search-input-container i {
            color: #64748b;
            margin-right: 8px;
            font-size: 16px;
        }
        
        .search-input-container input {
            flex: 1;
            border: none;
            background: transparent;
            outline: none;
            font-size: 15px;
            color: #1e293b;
        }
        
        .cancel-button {
            font-size: 15px;
            color: #16a34a;
            font-weight: 500;
        }
        
        .search-results {
            padding: 8px 16px 16px;
        }
        
        .search-result-header {
            font-size: 14px;
            color: #64748b;
            margin: 12px 0 8px;
        }
        
        .result-item {
            background-color: white;
            border-radius: 12px;
            padding: 16px;
            margin-bottom: 12px;
            display: flex;
            flex-direction: column;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
            transition: transform 0.1s ease, box-shadow 0.1s ease;
        }
        
        .result-item:active {
            transform: scale(0.98);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        }
        
        .medicine-name {
            font-size: 16px;
            font-weight: 600;
            color: #1e293b;
            margin-bottom: 4px;
        }
        
        .medicine-info {
            font-size: 14px;
            color: #64748b;
            margin-bottom: 8px;
        }
        
        .medicine-details {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 13px;
        }
        
        .expiry-date {
            color: #f59e0b;
        }
        
        .stock-status {
            color: #16a34a;
            font-weight: 500;
        }
        
        .no-results {
            text-align: center;
            padding: 60px 20px;
            color: #64748b;
        }
        
        .no-results-icon {
            font-size: 48px;
            margin-bottom: 16px;
            opacity: 0.5;
        }
        
        .no-results-text {
            font-size: 16px;
            margin-bottom: 8px;
        }
        
        .no-results-subtext {
            font-size: 14px;
            opacity: 0.8;
        }
    </style>
</head>
<body>
    <div class="iphone-frame">
        <!-- 顶部刘海 -->
        <div class="iphone-notch"></div>
        
        <!-- 状态栏 -->
        <div class="iphone-status-bar">
            <div>9:41</div>
            <div class="flex space-x-2">
                <i class="fa fa-signal"></i>
                <i class="fa fa-wifi"></i>
                <i class="fa fa-battery-full"></i>
            </div>
        </div>
        
        <!-- 页面标题栏 -->
        <div class="page-header">
            <button class="back-button" id="backButton">
                <i class="fa fa-chevron-left"></i>
            </button>
            <div class="header-title">搜索结果</div>
        </div>
        
        <!-- 内容区域 -->
        <div class="iphone-content">
            <!-- 搜索栏 -->
            <div class="search-bar">
                <div class="search-input-container">
                    <i class="fa fa-search"></i>
                    <input type="text" id="searchInput" placeholder="搜索药品名称或症状" value="感冒">
                </div>
                <div class="cancel-button" id="cancelButton">取消</div>
            </div>
            
            <!-- 搜索结果 -->
            <div class="search-results">
                <!-- 药品搜索结果 -->
                <div class="search-result-header">药品结果</div>
                <div class="result-item" data-medicine-id="1">
                    <div class="medicine-name">感冒灵颗粒</div>
                    <div class="medicine-info">用于感冒引起的头痛、发热、鼻塞、流涕</div>
                    <div class="medicine-details">
                        <div class="expiry-date">有效期至: 2024-12-31</div>
                        <div class="stock-status">库存: 10袋</div>
                    </div>
                </div>
                
                <div class="result-item" data-medicine-id="2">
                    <div class="medicine-name">复方感冒药</div>
                    <div class="medicine-info">缓解感冒症状，包括鼻塞、头痛、发热</div>
                    <div class="medicine-details">
                        <div class="expiry-date">有效期至: 2025-03-15</div>
                        <div class="stock-status">库存: 8片</div>
                    </div>
                </div>
                
                <div class="result-item" data-medicine-id="3">
                    <div class="medicine-name">小儿感冒颗粒</div>
                    <div class="medicine-info">用于小儿感冒引起的发热、头痛、咳嗽</div>
                    <div class="medicine-details">
                        <div class="expiry-date">有效期至: 2025-06-20</div>
                        <div class="stock-status">库存: 5袋</div>
                    </div>
                </div>
                
                <!-- 相关症状结果 -->
                <div class="search-result-header">相关症状</div>
                <div class="result-item">
                    <div class="medicine-name">头痛</div>
                    <div class="medicine-info">建议用药: 布洛芬缓释胶囊、对乙酰氨基酚</div>
                </div>
                
                <div class="result-item">
                    <div class="medicine-name">发热</div>
                    <div class="medicine-info">建议用药: 对乙酰氨基酚片、布洛芬混悬液</div>
                </div>
                
                <div class="result-item">
                    <div class="medicine-name">咳嗽</div>
                    <div class="medicine-info">建议用药: 急支糖浆、复方甘草片</div>
                </div>
            </div>
        </div>
        
        <!-- 底部导航栏 -->
        <div class="iphone-nav">
            <a href="index.html" class="nav-item">
                <i class="fa fa-home"></i>
                <span>首页</span>
            </a>
            <a href="medicine_management.html" class="nav-item">
                <i class="fa fa-medkit"></i>
                <span>药品</span>
            </a>
            <a href="add_medicine.html" class="nav-item">
                <i class="fa fa-plus"></i>
                <span>添加</span>
            </a>
            <a href="reminder.html" class="nav-item">
                <i class="fa fa-bell"></i>
                <span>提醒</span>
            </a>
            <a href="profile.html" class="nav-item">
                <i class="fa fa-user"></i>
                <span>我的</span>
            </a>
        </div>
        
        <!-- 底部安全指示器 -->
        <div class="iphone-home-indicator"></div>
    </div>

    <script>
        // 返回按钮点击事件
        document.getElementById('backButton').addEventListener('click', function() {
            console.log('用户点击了返回按钮');
            window.history.back();
        });
        
        // 取消按钮点击事件
        document.getElementById('cancelButton').addEventListener('click', function() {
            console.log('用户取消搜索');
            document.getElementById('searchInput').value = '';
            // 可以根据需要显示全部内容或导航回上一页
        });
        
        // 搜索输入框事件
        const searchInput = document.getElementById('searchInput');
        searchInput.addEventListener('input', function() {
            console.log('用户输入搜索内容:', this.value);
            // 在实际应用中，这里可以触发实时搜索
        });
        
        // 为结果项添加点击事件
        document.querySelectorAll('.result-item').forEach(item => {
            item.addEventListener('click', function() {
                const medicineId = this.getAttribute('data-medicine-id');
                if (medicineId) {
                    console.log('用户点击了药品:', medicineId);
                    // 跳转到药品详情页
                    window.location.href = `medicine_detail.html?id=${medicineId}`;
                } else {
                    console.log('用户点击了症状:', this.querySelector('.medicine-name').textContent);
                    // 在实际应用中，这里可以显示相关症状的详情或建议
                    alert(`显示${this.querySelector('.medicine-name').textContent}症状信息`);
                }
            });
        });
        
        // 初始化时自动聚焦搜索框
        searchInput.focus();
    </script>
</body>
</html>